/**
 * 
 */
package com.randis.dailyplanner.managers;

import java.util.Properties;

import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

/**
 * @author alpe
 *
 */
public class EmailManager {

	public void send(String email, String text) {
		Properties props = new Properties();
        Session session = Session.getDefaultInstance(props, null);

        try {
            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress("a.petinov@gmail.com"));
            msg.addRecipient(Message.RecipientType.TO,
                             new InternetAddress(email, "Mr. User"));
            msg.setSubject("test");
            msg.setText(text);
            Transport.send(msg);
    
        } catch (Exception e) {
        	throw new RuntimeException(e);
        } 		
	}

}
